import java.io.FileInputStream;
import java.math.BigInteger;
import java.security.PublicKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class shiyan5_1 {
    public static void main(String[] args) throws Exception{
            CertificateFactory cf=CertificateFactory.getInstance("X.509");
            FileInputStream in=new FileInputStream("./sslsocket.cer");
            java.security.cert.Certificate c=cf.generateCertificate(in);
            in.close();
            X509Certificate t=(X509Certificate) c;
            System.out.println("版本号 "+t.getVersion());
            System.out.println("序列号 "+t.getSerialNumber().toString(16));
            System.out.println("全名 "+t.getSubjectDN());
            System.out.println("签发者全名n"+t.getIssuerDN());
            System.out.println("有效期起始日 "+t.getNotBefore());
            System.out.println("有效期截至日 "+t.getNotAfter());
            System.out.println("签名算法 "+t.getSigAlgName());
            byte[] sig=t.getSignature();
            System.out.println("签名n"+new BigInteger(sig).toString(16));
        }
}
